package com.ruoyi.quartz.service.impl;

import java.util.List;
import java.util.Map;

import com.ruoyi.common.annotation.DataSource;
import com.ruoyi.common.enums.DataSourceType;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.quartz.mapper.CgImportMainMapper;
import com.ruoyi.quartz.domain.CgImportMain;
import com.ruoyi.quartz.service.ICgImportMainService;

/**
 * 采购订单汇总Service业务层处理
 * 
 * @author SYF
 * @date 2025-04-27
 */
@Service
public class CgImportMainServiceImpl implements ICgImportMainService 
{
    @Autowired
    private CgImportMainMapper cgImportMainMapper;


    /**
     * 查询采购订单汇总列表
     * 
     * @param cgImportMain 采购订单汇总
     * @return 采购订单汇总
     */
    @Override
    public List<CgImportMain> selectCgImportMainList(CgImportMain cgImportMain)
    {
        return cgImportMainMapper.selectCgImportMainList(cgImportMain);
    }

    /**
     * 新增采购订单汇总
     * 
     * @param cgImportMain 采购订单汇总
     * @return 结果
     */
    @Override
    @DataSource(DataSourceType.SLAVEDW)
    public int insertCgImportMain(CgImportMain cgImportMain) {
        return cgImportMainMapper.insertCgImportMain(cgImportMain);
    }

    /**
     * 修改采购订单汇总
     * 
     * @param cgImportMain 采购订单汇总
     * @return 结果
     */
    @Override
    public int updateCgImportMain(CgImportMain cgImportMain)
    {
        cgImportMain.setUpdateTime(DateUtils.getNowDate());
        return cgImportMainMapper.updateCgImportMain(cgImportMain);
    }

    @Override
    @DataSource(DataSourceType.SLAVEDM)
    public List<Map<String,Object>> getWesDay(String fhDate){
        return cgImportMainMapper.getWesDay(fhDate);
    }

    @Override
    @DataSource(DataSourceType.SLAVEDM)
    public List<Map<String,Object>> getCpDims(String yongyouCode){
        return cgImportMainMapper.getCpDims(yongyouCode);
    }

    @Override
    @DataSource(DataSourceType.SLAVEDW)
    public int clearCgImportMain(String year){
        return cgImportMainMapper.clearCgImportMain(year);
    }
}
